﻿using System;

using ApproveFlowEngine.Core.Base;
using ApproveFlowEngine.Enums.Core;

namespace ApproveFlowEngine.Core.Nodes
{
    public class WorkNodeCountersign : WorkNodeComplex
    {
        #region Public Constructors

        public WorkNodeCountersign(Guid id) : base(id)
        {
            NodeType = NodeType.Countersign;
        }

        #endregion Public Constructors



        #region Private Constructors

        private WorkNodeCountersign()
        {
            NodeType = NodeType.Countersign;
        }

        #endregion Private Constructors



        #region Public Properties

        public override ApproveNodeStatus Status
        {
            get
            {
                if (Children.Count == PassCount)
                {
                    return ApproveNodeStatus.Pass;
                }
                if (Children.Count == NoneCount)
                {
                    return ApproveNodeStatus.None;
                }
                if (RejectCount > 0)
                {
                    return ApproveNodeStatus.Reject;
                }
                return ApproveNodeStatus.Activity;
            }
        }

        #endregion Public Properties
    }
}